// import React from 'react'
// import { useRef } from 'react'
import axios from 'axios'
import PubSub from 'pubsub-js'
// import { PureComponent, createRef, forwardRef  } from 'react'

import React, { Component } from 'react'

export default class Sercher extends Component {
  shecher = () => {

    var input = document.getElementsByTagName('input')[0].value
    axios.get(`https://api.github.com/search/users?q=${input}`).then(res => {
      PubSub.publish('data', { user: res.data.items })
    })
  }
  render() {

    return (
      <div>
        <input type="text" /> <button onClick={this.shecher}>搜索</button>
      </div>
    )
  }
}

